<?php

use yii\helpers\Html;
use yii\widgets\DetailView;
use yii\bootstrap\Alert;

/* @var $this yii\web\View */
/* @var $model app\models\User */

$this->title = $model->truename;
$this->params['breadcrumbs'][] = ['label' => '我的资料', 'url' => ['view']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="user-view col-lg-4">

    <h1><?= Html::encode($this->title) ?></h1>
    <?php if( Yii::$app->getSession()->hasFlash('success') ) {
        echo Alert::widget([
            'options' => [
                'class' => 'alert-success', //这里是提示框的class
            ],
            'body' => Yii::$app->getSession()->getFlash('success'), //消息体
        ]);
    }
    if( Yii::$app->getSession()->hasFlash('error') ) {
        echo Alert::widget([
            'options' => [
                'class' => 'alert alert-danger',
            ],
            'body' => Yii::$app->getSession()->getFlash('error'),
        ]);
    } ?>

    <?= DetailView::widget([
        'model' => $model,
        'attributes' => [
            'truename',
            'email:email',
            'roles',
            'idcard',
            'gender',
            'birthday',
            'city',
            'mobile',
            'qq',
            'company',
            'job',
            'class',
            'student_id',
            'weixin',
            'iam',
            //'loginTime:datetime',
            //'loginIp',
            //'createdIp',
           // 'createdTime:datetime',
        ],
    ]) ?>

    <p>
        <?= Html::a('更新资料', ['update'], ['class' => 'btn btn-primary']) ?>
    </p>

</div>
<div class="user-view col-lg-6">

    <h1>战绩</h1>

    <div class="progress">

        <div class="progress-bar progress-bar-success progress-bar-striped active" role="progressbar" aria-valuenow="45" aria-valuemin="0" aria-valuemax="100" style="width: <?php echo $rates['attendance']; ?>%">
            <span class="sr-only">45% Complete</span>
            考勤<?php echo $rates['attendance']; ?>%
        </div>
    </div>
    <div class="progress">
        <div class="progress-bar progress-bar-info progress-bar-striped active" role="progressbar" aria-valuenow="45" aria-valuemin="0" aria-valuemax="100" style="width: <?php echo $rates['homework']; ?>%">
            <span class="sr-only">45% Complete</span>
            作业<?php echo $rates['homework']; ?>%
        </div>
    </div>
    <div class="progress">
        <div class="progress-bar progress-bar-warning progress-bar-striped active" role="progressbar" aria-valuenow="45" aria-valuemin="0" aria-valuemax="100" style="width: <?php echo $rates['test']; ?>%">
            <span class="sr-only">45% Complete</span>
            考试<?php echo $rates['test']; ?>%
        </div>
    </div>
    <div class="progress">
        <div class="progress-bar progress-bar-danger progress-bar-striped active" role="progressbar" aria-valuenow="45" aria-valuemin="0" aria-valuemax="100" style="width: <?php echo $rates['avg']; ?>%">
            <span class="sr-only">45% Complete</span>
            综合<?php echo $rates['avg']; ?>%
        </div>
    </div>

    <div class="alert alert-success" role="alert"><?php echo Yii::$app->params['rateRule']; ?></div>



</div>
